package com.yict.csms.system.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.yict.csms.company.entity.Company;

/**
 * 用户表Entity
 * 
 * @author Patrick.Deng
 * 
 */
@Entity
@Table(name = "CSMS_USER")
public class User implements Serializable {

	@Id
	@Column(name = "USERID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "csms_user_seq")
	@SequenceGenerator(name = "csms_user_seq", sequenceName = "SEQ_CSMS_USER", allocationSize = 1, initialValue = 1)
	private Long userId;

	@Column(name = "USERNAME")
	private String userName;

	@Column(name = "USERCNAME")
	private String userCName;

	@Column(name = "USERENAME")
	private String userEName;

	@Column(name = "USERPASSWORD")
	private String userPassWord;

	@Column(name = "PASSWORDREQ")
	private String passWordREQ;

	@Column(name = "EMAIL")
	private String email;

	@Column(name = "USERSTUTAS")
	private String userStutas;

	@Column(name = "DEPARTMENT")
	private String department;

	@Column(name = "REMARKS")
	private String remarks;

	@Column(name = "CREATEDATE")
	private Date createDate;

	@Column(name = "UPDATEDATE")
	private Date updateDate;

	/*@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CREATEPERSON")
	private User createPerson;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UPDATEPERSON")
	private User updatePerson;*/

	@Column(name = "CREATEPERSON")
	private Long createperson;

	@Column(name = "UPDATEPERSON")
	private Long updateperson;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "COMPANYID")
	private Company company;
	
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name = "USERID")
	private Set<UserDataper> userDataperSet = new LinkedHashSet<UserDataper>();
	
	@OneToMany(mappedBy="user")
	@JoinColumn(name = "USERID")
	private Set<UserUserGroup> userUserGroup = new LinkedHashSet<UserUserGroup>();

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserCName() {
		return userCName;
	}

	public void setUserCName(String userCName) {
		this.userCName = userCName;
	}

	public String getUserEName() {
		return userEName;
	}

	public void setUserEName(String userEName) {
		this.userEName = userEName;
	}

	public String getUserPassWord() {
		return userPassWord;
	}

	public void setUserPassWord(String userPassWord) {
		this.userPassWord = userPassWord;
	}

	public String getPassWordREQ() {
		return passWordREQ;
	}

	public void setPassWordREQ(String passWordREQ) {
		this.passWordREQ = passWordREQ;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUserStutas() {
		return userStutas;
	}

	public void setUserStutas(String userStutas) {
		this.userStutas = userStutas;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	/*public User getCreatePerson() {
		return createPerson;
	}

	public void setCreatePerson(User createPerson) {
		this.createPerson = createPerson;
	}

	public User getUpdatePerson() {
		return updatePerson;
	}

	public void setUpdatePerson(User updatePerson) {
		this.updatePerson = updatePerson;
	}*/

	public Long getCreateperson() {
		return createperson;
	}

	public void setCreateperson(Long createperson) {
		this.createperson = createperson;
	}

	public Long getUpdateperson() {
		return updateperson;
	}

	public void setUpdateperson(Long updateperson) {
		this.updateperson = updateperson;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public Set<UserDataper> getUserDataperSet() {
		return userDataperSet;
	}

	public void setUserDataperSet(Set<UserDataper> userDataperSet) {
		this.userDataperSet = userDataperSet;
	}

	public Set<UserUserGroup> getUserUserGroup() {
		return userUserGroup;
	}

	public void setUserUserGroup(Set<UserUserGroup> userUserGroup) {
		this.userUserGroup = userUserGroup;
	}
}
